package com.mbyte.easy.task.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mbyte.easy.qcbyclass.entity.QcbyClass;
import com.mbyte.easy.qcbyclass.service.IQcbyClassService;
import com.mbyte.easy.security.entity.SysUser;
import com.mbyte.easy.security.service.IUserService;
import com.mbyte.easy.task.entity.Task;
import com.mbyte.easy.task.mapper.TaskMapper;
import com.mbyte.easy.task.service.ITaskService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mbyte.easy.taskstudent.entity.TaskStudent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lp
 * @since 2020-06-16
 */
@Service
public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements ITaskService {

    @Autowired
    private ITaskService taskService;

    @Override
    public IPage<Task> selectAllTask(Page<Task> userPage, QueryWrapper<Task> queryWrapper, Long id) {

        IPage<Task> page = page(userPage,queryWrapper);

        page.setRecords(null);

        List<Task> records = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getUserId,id));

        System.out.println(records);
        List<Task> taskList = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getUserId,id));

        page.setRecords(records);
        return page;
    }
}
